import hashlib
import os
import datetime


filepath = 'F:\\data\\80年代性感健美操_超清.mp4'


def GetFileMd5(filename):
    md5 = hashlib.md5()
    with open(filepath, mode="rb") as f:
        by = f.read()
    md5.update(by)
    ret = md5.hexdigest()
    return ret


# 输出文件的md5值以及记录运行时间
starttime = datetime.datetime.now()
print(GetFileMd5(filepath))
endtime = datetime.datetime.now()
#
print('运行时间：%ds'%((endtime-starttime).seconds))